package com.whw.springboot.bcucb.service.serviceImpl;

import com.whw.springboot.bcucb.entity.Message;
import com.whw.springboot.bcucb.entity.Star;
import com.whw.springboot.bcucb.mapper.StarMapper;
import org.springframework.stereotype.Service;
import com.whw.springboot.bcucb.service.StarService;

import javax.annotation.Resource;
import java.util.List;

@Service
public class StarServiceImpl implements StarService {
    @Resource
    private StarMapper starMapper;

    @Override
    public Message<?> deleteByPrimaryKey(int starId) {

        return starMapper.deleteByPrimaryKey(starId)>0?Message.success(null):Message.fail(null);
    }

    @Override
    public Message<?> insert(Star record) {

        return starMapper.insert(record)>0?Message.success(null):Message.fail(null);
    }

    @Override
    public Message<?> insertSelective(Star record) {

        return starMapper.insertSelective(record)>0?Message.success(null):Message.fail(null);
    }

    @Override
    public Message<Star> selectByPrimaryKey(int starId) {
        return Message.success(null).add(starMapper.selectByPrimaryKey(starId));
    }

    @Override
    public Message<?> updateByPrimaryKeySelective(Star record) {
        return starMapper.updateByPrimaryKeySelective(record)>0?Message.success(null):Message.fail(null);
    }

    @Override
    public Message<?> updateByPrimaryKey(Star record) {

        return starMapper.updateByPrimaryKey(record)>0?Message.success(null):Message.fail(null);
    }

    @Override
    public Message<List<Star>> selectAll() {
        return Message.success(null).add(starMapper.selectAll());
    }

}
